package com.wgy.day7;

/**
 * Created by pc on 2020/11/2 20:28
 * Description: Demo1
 */
public class Demo12HundredSum {
    public static void main(String[] args) {
        int a = 2;
        int sum = 0;
        do {
            sum = sum + a;
            a += 2;
        }
        while (a <= 100);
        System.out.println(sum);
        System.out.println("========");
        int b = 2;
        int sum1 = 0;
        while (b <= 100) {
            sum1 += b;
            b += 2;
        }
        System.out.println(sum1);
        System.out.println("========");
        int sum3 = 0;
        for (int c = 2; c <= 100; c += 2) {
            sum3 = sum3 + c;

        }
        System.out.println(sum3);
        System.out.println("====");
        int sum4 = 0;
        for (int d = 1; d <= 100; d++) {
            if (d % 2 == 0) {
                sum4 += d;
            }
        }
        System.out.println(sum4);
    }
}
